package com.zzyl.nursing.controller.member;

import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.AjaxResult;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.serve.domain.NursingProject;
import com.zzyl.serve.service.INursingProjectService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @version: 1.0
 * @Author: ljy
 * @description:
 * @date: 2025-07-31 19:42
 */

@RestController
@RequestMapping("/member/orders/project")
@Slf4j
public class MemberOrderController extends BaseController {


    //自动注入NursingProjectService对象
    @Autowired
    private INursingProjectService nursingProjectService;

    //分页查询
    @GetMapping("/page")
    public TableDataInfo<List<NursingProject>> list(NursingProject nursingProject) {
        startPage();
        List<NursingProject> list = nursingProjectService.selectNursingProjectList(nursingProject);
        return getDataTable(list);
    }

    //根据id查询
    @GetMapping("/{id}")
    public AjaxResult get(@PathVariable Long id) {
        log.info("根据id查询护理项目，当前id为 {}", id);
        NursingProject nursingProject = nursingProjectService.selectNursingProjectById(id);
        return success(nursingProject);
    }
}
